package com.bjc.base.validation.constraints.validator;

import javax.validation.ConstraintValidator;
import javax.validation.ConstraintValidatorContext;

import com.bjc.base.validation.constraints.Gender;
import com.bjc.base.validation.constraints.IsGender;

/**
 * 性别校验器
 * 
 * @author 许自辉
 * @date 2017年9月20日
 */
public class IsGenderValidator implements ConstraintValidator<IsGender, String> {

	@Override
	public void initialize(IsGender constraintAnnotation) {
	}

	@Override
	public boolean isValid(String value, ConstraintValidatorContext context) {
		return Gender.contains(value.toLowerCase());
	}
}